mem_label_start:		equ	0xc000
cards_regs:				equ mem_label_start
player_tower_height:	equ	cards_regs				+ 6685;6544

number_menu_options:	equ	player_tower_height		+ 1
player_wall_height:		equ	player_tower_height		+ 1

action_number_set:		equ	player_wall_height 		+ 1
player_foes_value:		equ	player_wall_height 		+ 1

menu_save_or_load:		equ player_foes_value		+ 1
player_dungeon_value:	equ	player_foes_value		+ 1

player_gems_value:		equ	player_dungeon_value	+ 1
player_magic_value:		equ	player_gems_value		+ 1
player_bricks_value:	equ	player_magic_value		+ 1
player_quarry_value:	equ	player_bricks_value 	+ 1


cpu_tower_height:		equ	player_quarry_value		+ 1
cpu_wall_height:		equ	cpu_tower_height		+ 1
cpu_foes_value:			equ	cpu_wall_height 		+ 1
cpu_dungeon_value:		equ	cpu_foes_value 			+ 1
cpu_gems_value:			equ	cpu_dungeon_value		+ 1
cpu_magic_value:		equ	cpu_gems_value			+ 1
cpu_bricks_value:		equ	cpu_magic_value			+ 1
cpu_quarry_value:		equ	cpu_bricks_value		+ 1	

player_hand:			equ	cpu_quarry_value		+ 1  ;6
cpu_hand:				equ	player_hand 			+ 6  ;6

cursor_data:			equ	cpu_hand 				+ 6	;2	;+0=0/1 +1=0-5

cursor_sprites_attr:	equ	cursor_data				+ 2; 6*4 (6 spr x 4 attribs)
tinymage_eyes_struct:   equ	cursor_sprites_attr		+ 6*4; 2 (tinymage_eyes_struct = color , tinymage_eyes_struct+1=delay counter)
cursor_flash_struct:	equ	tinymage_eyes_struct	+ 2; 2 (cursor_flash_struct = state , cursor_flash_struct+1=delay counter)
background_fx_struct:	equ	cursor_flash_struct		+ 2; 12 ;fxnumber, state, counter, max_counter, 4 bytes attr spr1, 4 bytes att spr2 
flags_fx_struct:		equ	background_fx_struct	+12; 21 ;scene index flag1,scene index flag2,counterflag1,counterflag2,maxcounter,flag1spr1 4 bytes sprattrb,flag1 spr2 4 bytes sprattrb,flag2 spr1/2 4+4
debris_fx_struct:		equ	flags_fx_struct			+21; 20 ;ct1  ct2   cw1   cw2   c   c    c   c   c   c  x2 (status + counters) ;TODO: this info probably needs to be updated
debris_fx_spr_struct:	equ	debris_fx_struct		+20; 4*4 +  6*4 = 16+24 = 40
shop_fire_struct:		equ	cursor_data				+2; ;WARNING, reallocating space!
														;counterf0,cf1,cf2,cf3,cf4,cf5,
														;index0,i1,i2,i3,i4,i5, 
														;4bytesspr00,4bytesspr01,4bytesspr10,4bytesspr11,4bytesspr20,4bytesspr21,4bytesspr30,4bytesspr31,4bytesspr40,4bytesspr41,4bytesspr50,4bytesspr51
														;6+ 6 + 4*2*6 = 12 + 48 = 60 bytes


turn:					equ	debris_fx_spr_struct	+ 56;1	;0=player,1=cpu
prev_turn:				equ	turn					+ 1	;1	;0=player,1=cpu
play_again:				equ	prev_turn				+ 1
forced_to_drop:			equ	play_again				+ 1	;0 not forced , 1 forced

keyboard_pressed:		equ	forced_to_drop			+ 1
cpu_delay:				equ	keyboard_pressed		+ 1

card_number:			equ	cpu_delay				+ 1

about_to_die:			equ	card_number				+ 1  ;1

seed:					equ	about_to_die			+ 1  ;2

shop_card_list:			equ	seed					+ 2	;7	;initialy 6 , future versions 7 (better scroll)


player_max_cards_mask:	equ	shop_card_list			+ 7	;1
cpu_max_cards_mask:		equ	player_max_cards_mask	+ 1	;1
player_cards_deck:		equ	cpu_max_cards_mask		+ 1 ;NUMBER_OF_CARDS	;max cards

enemy_current_deck_pointer	equ	player_cards_deck	+ NUMBER_OF_CARDS ;2
shop_cards_in_deck:		equ	enemy_current_deck_pointer	+ 2	;1
shop_cards_owned:		equ	shop_cards_in_deck		+ 1 ;1
shop_coins:				equ	shop_cards_owned		+ 1 ;2
shop_filter:			equ	shop_coins				+ 2	;1	;0 all, 1 brown 2 blue 3 green 
shop_action:			equ	shop_filter				+ 1	;8	;action message
shop_topcards_template:	equ	shop_action				+ 8 ;90
shop_flashing_flags_counter:	equ	shop_topcards_template	+ 90;1	


mmenu_option:			equ	shop_flashing_flags_counter	+ 1	;1	;0-first,..

quest_current_enemy:	equ	mmenu_option			+ 1	;1	;0-first evil mage, 1-second ....
quest_battle:			equ	quest_current_enemy		+ 1	;1	;0-training , 1-quest battle

;pointer_battle_backgrnd:equ	quest_battle			+ 1; 2
left_backgrnd_buffer:	equ quest_battle			+ 1	;66 (11*6)
right_backgrnd_buffer: 	equ left_backgrnd_buffer 	+ 66; 66

pointer_to_buffer:		equ	right_backgrnd_buffer	+ 66;2	;will be tmpbuffer or shop_card_deck_buffer

card_detail_buffer:		equ	pointer_to_buffer		+ 2
tmp_buffer:				equ	pointer_to_buffer		+ 2	;300	;max 288 (shop cards)

shop_card_deck_buffer:	equ	tmp_buffer				+ 300	;300

filter_buffer:			equ shop_card_deck_buffer	+ 300
tmp_buffer2:			equ	shop_card_deck_buffer	+ 300	;80	

tmp_buffer3:			equ	tmp_buffer2				+ 80 ;10

shop_counters_buffer:	equ	tmp_buffer3				+ 10	;9 

player_deck_status:		equ	shop_counters_buffer	+ 9	;MAX_CARDS_GAME+1		;describes whether card is owned and in deck (&b01000000 and &b10000000 )

buffer_player:			equ	player_deck_status		+ MAX_CARDS_GAME+1	;0x40		; buffer del player de WYZ


N_EFECTO:				equ	buffer_player 			+ 0x40	; 1 DB : NUMERO DE SONIDO
PUNTERO_EFECTO:			equ	N_EFECTO 				+ 1		; 2 DW : PUNTERO DEL SONIDO QUE SE REPRODUCE;REPRODUCE EFECTOS
CANAL_EFECTOS:			equ	PUNTERO_EFECTO 			+ 2		;1 DB : 1:CANAL A - 2:CANAL B - OTRO:CANAL C

TABLA_SONG				equ	CANAL_EFECTOS			+ 1	;2
TABLA_PAUTAS:			equ	TABLA_SONG				+ 2	;8*2

;TABLA_SONIDOS:			ds	3*2
saveload_buffer:		equ	TABLA_PAUTAS			+ 8*2
text_buffer:			equ	TABLA_PAUTAS			+ 8*2
graphics_buffer:		equ	TABLA_PAUTAS			+ 8*2	;2240;6144;0xdff;1640
card_art_buffer:		equ	graphics_buffer			+ 2240+512;2240	;(24*8)+1
card_art_buffer_color	equ	card_art_buffer			+ (24*8)+1	;(24*8)

;scroll text
dump_step:				equ	card_art_buffer_color	+ (24*8)	;1
txt_ptr:				equ	dump_step				+ 1	;2			;text-endtext
odd:					equ	txt_ptr					+ 2	;1			;0=false, 1=true		
	
txtscrolllin:			equ	odd						+ 1	;1			
;scroll text end
cheat:					equ	txtscrolllin			+ 1 ;1		;0 no, 1 yes
;slot vars
slotvar: 				equ cheat					+ 1 ;1 My Rom slot
sram_slot_page1:		equ	slotvar 				+ 1	;1 byte
sram_found:				equ	sram_slot_page1 		+ 1	;1 byte
ram_cfg:				equ	sram_found				+ 1 ;2 byte
rom_cfg:				equ	ram_cfg					+ 2 ;2 byte

background_left:		equ	rom_cfg					+ 2	;6*6
background_right:		equ	background_left			+ 6*6;6*6
;redrawing flags
dump_flags:				equ	background_right		+ 6*6;1
;battle
;0x1->left card
;0x2->right card
;;;;;;;;0x4->towers and walls
;0x8->show discarded flag on right card
;;;;;;;;;0x10->update tower flags fx
;shop
;0x1->card detail
;0x2->topcards
;0x4->filter
;0x8->action
;0x10=16->counters
;0x20=32->buy is set

music_onoff:			equ	dump_flags				+ 1; 1				;TODO: remove if not needed next reference
good_rand_offset:		equ	dump_flags				+ 1; 1
font_buffer:			equ	music_onoff				+ 1	;56*8	
music_buffer:			equ	music_onoff				+ 1; 1318
IF DEBUG_MODE==1
debug_buffer1:			equ	good_rand_offset		+ 1	;3
show_debug_vars:		equ debug_buffer1			+ 3 ;1					
ENDIF
